<template>
    <div>
        <h1>修改患者信息</h1>
        <div>
         <el-form ref="form"  :model="form" label-width="150px" >
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名" prop="name">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="性别">
                     <el-radio-group v-model="form.isGender">
                    <el-radio :label="0">女</el-radio>
                    <el-radio :label="1">男</el-radio>
                    </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                <el-form-item label="身份证号">
                    <el-input v-model="form.idcard"></el-input>
                </el-form-item>
                </el-col>
                <el-col :span="12">
                <el-form-item label="年龄">
                    <el-input-number v-model="form.age" :min="1" :max="120" ></el-input-number>
                </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                <el-form-item label="电话号码" prop="phone">
                    <el-input v-model="form.phone"></el-input>
                </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="住院日期">
                       <el-date-picker
                            v-model="form.value1"
                            type="date"
                            placeholder="住院日期">
                            </el-date-picker>
                        </el-form-item>
               </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">  
                <el-form-item label="治疗医院" prop="area">
                        <el-input v-model="form.area"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="是否重症">
                    <el-radio-group v-model="form.isHealthy">
                    <el-radio :label="0">否</el-radio>
                    <el-radio :label="1">是</el-radio>
                    </el-radio-group>
                    </el-form-item>
                </el-col>
            </el-row> 
            <el-row>
                <el-col :span="12">       
                <el-form-item label="感染来源">
                    <el-input v-model="form.where"></el-input>
                </el-form-item>
                
                <el-form-item label="住址">
                    <el-input v-model="form.address"></el-input>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input type="textarea" v-model="form.desc" rows="4" max="200"></el-input>
                </el-form-item>

                 </el-col> 
                 <el-col :span="12">   
                     <el-form-item label="症状">
                         <el-input v-model="form.sym"></el-input>
                     </el-form-item>
                </el-col>
            </el-row>   
                <el-form-item>
                <el-button type="primary" @click="onSubmit">提交</el-button>
                <el-button>取消</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>
<script>
import request from '@/utils/request'
  export default {
    data() {
      return {
        form: {
        //   area:'',
        //   name: '',
        //   phone: '',
        //   idcard: '',
        //   address: '',
        //   carNum:'',
        //   isGender:1,
        //   temper:undefined,//数字类型没有默认值时，添undefined
        //   age:undefined,
        //   history:0,
        //   desc: '',
        //   value:'',
        //   sym:'',
        },
        //
        // rules:{ 
        //     name: [
        //          { required: true, message: '请输入姓名', trigger: 'blur' },
        //          { min: 1, max: 10, message: '长度在 1 到 15 个字符', trigger: 'blur' }
        //   ],
        //     area: [
        //          { required: true, message: '请输入地址', trigger: 'blur' },
        //          { max: 10, message: '长度不超过10 个字符', trigger: 'blur' }
        //   ],
        //    phone: [
        //          { required: true, message: '请输入手机号', trigger: 'blur' },
        //          { min: 11,max:11,  message: '请正确输入手机号', trigger: 'change' },
        //          {
                    
        //          }
        //   ],
        // }
      }
    },
    created(){
       this.onSubmit() 
    },
    methods: {
      onSubmit() {
        request({
            url:'../patient_alter.json',
            method:'get'
        }).then((response)=>{
            this.form = response.data
            console.log(this.form)
        })
      },
    
     
    //   data() {
    //   return {
    //     pickerOptions: {
    //       disabledDate(time) {
    //         return time.getTime() > Date.now();
    //       },
    //       shortcuts: [{
    //         text: '今天',
    //         onClick(picker) {
    //           picker.$emit('pick', new Date());
    //         }
    //       }, {
    //         text: '昨天',
    //         onClick(picker) {
    //           const date = new Date();
    //           date.setTime(date.getTime() - 3600 * 1000 * 24);
    //           picker.$emit('pick', date);
    //         }
    //       }, {
    //         text: '一周前',
    //         onClick(picker) {
    //           const date = new Date();
    //           date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
    //           picker.$emit('pick', date);
    //         }
    //       }]
    //     },
    //   };
    // }
    }
  }
</script>